1 module directx.d3dx11async;
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 //  Copyright (c) Microsoft Corporation.  All rights reserved.
5 //
6 //  File:       D3DX11Async.h
7 //  Content:    D3DX11 Asynchronous Shader loaders / compilers
8 //
9 //////////////////////////////////////////////////////////////////////////////
10 
11 version(Windows):
12 version(Direct3D_11):
13 
14 import directx.d3d11;
15 import directx.d3dcommon;
16 import directx.win32;
17 import directx.d3dx11core;
18 import directx.d3dcommon;
19 import directx.d3dx11tex;
20 
21 // declared in d3d10shader.h
22 alias LPD3DINCLUDE LPD3D10INCLUDE;
23 alias D3D_SHADER_MACRO D3D10_SHADER_MACRO;
24 
25 extern (Windows) {
26 
27 //----------------------------------------------------------------------------
28 // D3DX11Compile:
29 // ------------------
30 // Compiles an effect or shader.
31 //
32 // Parameters:
33 //  pSrcFile
34 //      Source file name.
35 //  hSrcModule
36 //      Module handle. if NULL, current module will be used.
37 //  pSrcResource
38 //      Resource name in module.
39 //  pSrcData
40 //      Pointer to source code.
41 //  SrcDataLen
42 //      Size of source code, in bytes.
43 //  pDefines
44 //      Optional NULL-terminated array of preprocessor macro definitions.
45 //  pInclude
46 //      Optional interface pointer to use for handling #include directives.
47 //      If this parameter is NULL, #includes will be honored when compiling
48 //      from file, and will error when compiling from resource or memory.
49 //  pFunctionName
50 //      Name of the entrypoint function where execution should begin.
51 //  pProfile
52 //      Instruction set to be used when generating code.  Currently supported
53 //      profiles are "vs_1_1",  "vs_2_0", "vs_2_a", "vs_2_sw", "vs_3_0",
54 //                   "vs_3_sw", "vs_4_0", "vs_4_1",
55 //                   "ps_2_0",  "ps_2_a", "ps_2_b", "ps_2_sw", "ps_3_0", 
56 //                   "ps_3_sw", "ps_4_0", "ps_4_1",
57 //                   "gs_4_0",  "gs_4_1",
58 //                   "tx_1_0",
59 //                   "fx_4_0",  "fx_4_1"
60 //      Note that this entrypoint does not compile fx_2_0 targets, for that
61 //      you need to use the D3DX9 function.
62 //  Flags1
63 //      See D3D10_SHADER_xxx flags.
64 //  Flags2
65 //      See D3D10_EFFECT_xxx flags.
66 //  ppShader
67 //      Returns a buffer containing the created shader.  This buffer contains
68 //      the compiled shader code, as well as any embedded debug and symbol
69 //      table info.  (See D3D10GetShaderConstantTable)
70 //  ppErrorMsgs
71 //      Returns a buffer containing a listing of errors and warnings that were
72 //      encountered during the compile.  If you are running in a debugger,
73 //      these are the same messages you will see in your debug output.
74 //  pHResult
75 //      Pointer to a memory location to receive the return value upon completion.
76 //      Maybe NULL if not needed.
77 //      If pPump != NULL, pHResult must be a valid memory location until the
78 //      the asynchronous execution completes.
79 //----------------------------------------------------------------------------
80 
81 HRESULT D3DX11CompileFromFileA(LPCSTR pSrcFile, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude,
82         LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
83 		
84 HRESULT D3DX11CompileFromFileW(LPCWSTR pSrcFile, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude,
85         LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
86 
87 // TODO: make sure this matches phobos win32 style
88 alias D3DX11CompileFromFileW D3DX11CompileFromFile;
89 
90 
91 HRESULT D3DX11CompileFromResourceA(HMODULE hSrcModule, LPCSTR pSrcResource, LPCSTR pSrcFileName, const(D3D10_SHADER_MACRO)* pDefines, 
92     LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
93 
94 HRESULT D3DX11CompileFromResourceW(HMODULE hSrcModule, LPCWSTR pSrcResource, LPCWSTR pSrcFileName, const(D3D10_SHADER_MACRO)* pDefines, 
95     LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
96 
97 alias D3DX11CompileFromResourceW D3DX11CompileFromResource;
98 
99 
100 HRESULT D3DX11CompileFromMemory(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, 
101     LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
102 	
103 HRESULT D3DX11PreprocessShaderFromFileA(LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, 
104     LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
105 
106 HRESULT D3DX11PreprocessShaderFromFileW(LPCWSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, 
107     LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
108 
109 HRESULT D3DX11PreprocessShaderFromMemory(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, 
110     LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
111 	
112 HRESULT D3DX11PreprocessShaderFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, const(D3D10_SHADER_MACRO)* pDefines, 
113     LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
114 
115 HRESULT D3DX11PreprocessShaderFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, const(D3D10_SHADER_MACRO)* pDefines, 
116     LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
117 
118 alias D3DX11PreprocessShaderFromFileW D3DX11PreprocessShaderFromFile;
119 alias D3DX11PreprocessShaderFromResourceW D3DX11PreprocessShaderFromResource;
120 
121 
122 //----------------------------------------------------------------------------
123 // Async processors
124 //----------------------------------------------------------------------------
125 
126 HRESULT D3DX11CreateAsyncCompilerProcessor(LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, 
127         LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2,
128         ID3D10Blob* ppCompiledShader, ID3D10Blob* ppErrorBuffer, ID3DX11DataProcessor* ppProcessor);
129 
130 HRESULT D3DX11CreateAsyncShaderPreprocessProcessor(LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, 
131         ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorBuffer, ID3DX11DataProcessor* ppProcessor);
132 
133 //----------------------------------------------------------------------------
134 // D3DX11 Asynchronous texture I/O (advanced mode)
135 //----------------------------------------------------------------------------
136 
137 HRESULT D3DX11CreateAsyncFileLoaderW(LPCWSTR pFileName, ID3DX11DataLoader* ppDataLoader);
138 HRESULT D3DX11CreateAsyncFileLoaderA(LPCSTR pFileName, ID3DX11DataLoader* ppDataLoader);
139 HRESULT D3DX11CreateAsyncMemoryLoader(LPCVOID pData, SIZE_T cbData, ID3DX11DataLoader* ppDataLoader);
140 HRESULT D3DX11CreateAsyncResourceLoaderW(HMODULE hSrcModule, LPCWSTR pSrcResource, ID3DX11DataLoader* ppDataLoader);
141 HRESULT D3DX11CreateAsyncResourceLoaderA(HMODULE hSrcModule, LPCSTR pSrcResource, ID3DX11DataLoader* ppDataLoader);
142 
143 alias D3DX11CreateAsyncFileLoaderW D3DX11CreateAsyncFileLoader;
144 alias D3DX11CreateAsyncResourceLoaderW D3DX11CreateAsyncResourceLoader;
145 
146 
147 HRESULT D3DX11CreateAsyncTextureProcessor(ID3D11Device pDevice, D3DX11_IMAGE_LOAD_INFO* pLoadInfo, ID3DX11DataProcessor* ppDataProcessor);
148 HRESULT D3DX11CreateAsyncTextureInfoProcessor(D3DX11_IMAGE_INFO* pImageInfo, ID3DX11DataProcessor* ppDataProcessor);
149 HRESULT D3DX11CreateAsyncShaderResourceViewProcessor(ID3D11Device pDevice, D3DX11_IMAGE_LOAD_INFO* pLoadInfo, ID3DX11DataProcessor* ppDataProcessor);
150 
151 }